package gyb.rasa.common.handler.handler;

import gyb.rasa.common.handler.exceptionhandler.MyException;
import gyb.rasa.common.utils.JwtUtil;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author: 郜宇博
 */
//@Configuration
public class LoginInterceptor  extends HandlerInterceptorAdapter {

    //@Override
    //public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    //    System.out.println("已拦截:"+request.getRequestURI());
    //    boolean isLogin = JwtUtil.checkToken(request);
    //    System.out.println("isLogin:"+isLogin);
    //    if(isLogin){
    //        System.out.println("已放行:"+request.getRequestURI());
    //        return true;
    //    }else {
    //        throw new MyException(20001,"请登录");
    //    }
    //}
}
